package cn.wizzer.app.user.modules.services.account;

import cn.wizzer.app.sys.modules.models.SysPayWayBank;
import cn.wizzer.app.user.modules.models.UserRecharge;
import cn.wizzer.app.user.modules.models.dto.ElephantRechargeDTO;
import cn.wizzer.app.user.modules.models.dto.GlobalPayRechargeDTO;
import cn.wizzer.app.user.modules.models.dto.XindovndRechargeDTO;
import cn.wizzer.app.user.modules.models.enums.PayChannel;
import cn.wizzer.app.user.modules.models.enums.RechargeStatusEnum;
import cn.wizzer.app.user.modules.models.vo.UserRechargeVO;
import cn.wizzer.framework.base.service.BaseService;
import cn.wizzer.framework.page.Pagination;

import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import java.text.ParseException;

public interface UserRechargeService extends BaseService<UserRecharge> {

    UserRecharge add(int amount, String appid, PayChannel channel, String currencyId, String bankLibId);

    void manual(BigDecimal amount, String toUser, String updaterId, String currencyId, PayChannel channel);

    /**
     * 分页，如果这个改了，下面的求和方法也需要改
     *
     * @param orderNo
     * @param searchKeyword
     * @param searchDate
     * @param status
     * @param channel
     * @param currencyId
     * @param times
     * @param pageNumber
     * @param pageSize
     * @return
     */
    Pagination listPage(String conditionData, String orderNo, String searchKeyword, String[] searchDate, RechargeStatusEnum status,
                        PayChannel channel, String currencyId, int times, int pageNumber, int pageSize);

    /**
     * 根据分页的请求参数，统计
     * 如果分页改了请求参数，这个方法也需要改下
     *
     *
     * @param conditionData
     * @param orderNo
     * @param searchKeyword
     * @param searchDate
     * @param status
     * @param channel
     * @param currencyId
     * @param times
     * @return
     */
    BigDecimal searchSum(String conditionData, String orderNo, String searchKeyword, String[] searchDate, RechargeStatusEnum status,
                         PayChannel channel, String currencyId, int times);


    /**
     * 确认付款/确认到账
     *
     * @param id
     * @param sure
     * @param remark
     * @param rAmount     根据实际付款金额进行到账
     * @param platformUid
     */
    UserRecharge examine(String id, Boolean sure, String remark, String rAmount, String platformUid);


    /**
     * 查询充值记录详情
     *
     * @param where
     * @return
     */
    UserRechargeVO detail(String where);

    String oneWalletNotify(String respBody) throws Exception;

    /**
     * OneWallet get pay url
     *
     * @param appid
     * @param currencyId
     * @param amount
     * @param bankCode
     * @return
     */
    String oneWalletToPay(String appid, String currencyId, int amount, SysPayWayBank bankCode) throws Exception;

    UserRecharge xindovndNotify(XindovndRechargeDTO xin) throws ParseException, UnsupportedEncodingException;

    String xindovndToPay(String appid, String currencyId, int amount, String requestURL) throws IOException;

    /**
     * 大象支付充值
     *
     * @param appid
     * @param currencyId
     * @param amount
     * @param requestURL 请求路径
     * @return
     * @throws IOException
     */
    String elephantToPay(String appid, String currencyId, int amount, String requestURL) throws IOException;

    /**
     * 大象支付充值回调
     *
     * @param elephant
     * @return
     * @throws ParseException
     * @throws UnsupportedEncodingException
     */
    UserRecharge elephantNotify(ElephantRechargeDTO elephant) throws ParseException, UnsupportedEncodingException;

    /**
     * 查询是否有自己充值过的订单
     *
     * @param userId
     * @return
     */
    boolean isRecharge(String userId);


    /**
     * 印尼GlobalPay充值
     * @param appid
     * @param currencyId
     * @param channel
     * @param amount
     * @param requestURL 请求路径
     * @return
     */
    String globalPayToPay(String appid, String currencyId, PayChannel channel, int amount, String requestURL)  throws IOException;

    /**
     * 印尼GlobalPay充值回调
     * @param globalPay
     * @return
     */
    UserRecharge globalPayNotify(GlobalPayRechargeDTO globalPay) throws ParseException, UnsupportedEncodingException;

}
